package demo7;

//import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

@Component
public class Person {
    private String name;

    public Person(){
        System.out.println("Person的构造器执行了");
    }

//    @Value("张三")
//    public void setName(String name) {
//        System.out.println("Person的setName方法执行了");
//        this.name = name;
//    }

    @PostConstruct
    public void init(){
        System.out.println("Person的init方法执行了");
    }

    @PreDestroy
    public void destroy(){
        System.out.println("Person的destroy方法执行了");
    }

    @Override
    protected void finalize() throws Throwable {
        super.finalize();
    }
}
